package server;

import java.util.Map;
import java.util.TimerTask;

/**
 * Cleans the cache of stale values.
 * 
 * @author Jeff
 */
public class HvZCacheCleaner extends TimerTask {
    private Map<UserCache.CacheType, UserCache> caches;

    /**
     * Constructs a new HvZCacheCleaner
     * 
     * @param caches
     *            the cache to clean
     */
    public HvZCacheCleaner(Map<UserCache.CacheType, UserCache> caches) {
        this.caches = caches;
    }

    /**
     * Starts the cache cleaner.
     */
    @Override
    public void run() {
        for (UserCache cache : caches.values())
            cache.cleanCache();
    }

}
